Q: Filenames that work on the Windows version sometimes
don't work on UNIX.
The path separator character is a backslash character "\" on Windows and a
foreslash aka divide character "/" on UNIX. So
"\\xb\\xxx\\entry.xxx" and "/xb/xxx/entry.xxx" are valid filenames for
Windows and UNIX respectively. Remember, a single backslash character is represented
by two backslashes in literal strings.
To make source programs as portable as possible, standard library functions and the OPEN() intrinsic accept filenames with either separator.
These functions call XstPathString$() to convert every improper separator to the
proper separator before they continue.
To make sure you avoid potential filename problems, however, substitute the $$PathSlash$
constant defined in the standard library for every occurrence of the literal separator
character. Alternately, call XstPathString$() to convert filename strings into the
correct format. This function takes either form and returns a valid path string for
the current system. XstPathString$() also expands environment variables.
"$HOME/research/lens0034.dat" and "$(HOME)\\research\\lens0034.dat"
are thus acceptable arguments - $HOME or $(HOME) are replaced by the HOME environment
variable string.
Not Portable: "\\xb\\circle.x" ...or...
"/xb/circle.x"
Portable: $$PathSlash$ + "xb" + $$PathSlash$
+ "circle.x"
Portable: "$(XBDIR)" + $$PathSlash$ +
"circle.x"
Not Portable: "\\xb\\circle.x" ...or...
"/xb/circle.x"
Portable: path$ = XstPathString$
("$XBDIR/circle.x")
Portable: path$ = XstPathString$
("\\xb\\circle.x")
Portable: path$ = XstPathString$
("/xb/circle.x")
Functions that return a path or file name return the path separator character appropriate
to the system the program is running on. Programs that search for path separator
characters in path or file name strings should therefore search for $$PathSlash$ instead
of "\\" or "/" .
Not Portable: slash = INSTR (path$, "\\")
Not Portable: slash = INSTR (path$, "/")
Portable: slash = INSTR (path$, $$PathSlash$)
A shared constant is also defined in the standard library for the binary form of the path
separator.
Windows: $$PathSlash = '\\'
UNIX: $$PathSlash = '/'